home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
221_01
/
cc1.asm
< prev
next >
Wrap
Assembly Source File
|
1980-01-01
|
19KB
|
1,637 lines
;small-c V2.3
EXT ccdiv,ccmult
EXT fopen,fclose,getc,putc,putchar,getchar,rewind,gets
EXT exit
EXT CCSWITCH
EXT CCPOLL
EXT isalpha,isupper,islower,isdigit,isspace
EXT toupper,tolower
EXT strlen,reverse,left,strcmp,strcpy
EXT abs,itoa,atoi,printf
GLOBAL _char
_char
FCB 99,104,97,114,0
GLOBAL _int
_int
FCB 105,110,116,0
GLOBAL stattab
stattab
RZB 690
GLOBAL symtab
symtab
RZB 8008
GLOBAL glbptr
glbptr
FDB 0
GLOBAL locptr
locptr
FDB 0
GLOBAL statptr
statptr
FDB 0
GLOBAL endsearc
endsearc
FDB 0
GLOBAL startcom
startcom
FDB 0
GLOBAL swq
swq
RZB 100
GLOBAL argcs
argcs
RZB 2
GLOBAL argvs
argvs
FDB 0
GLOBAL wq
wq
RZB 200
GLOBAL wqptr
wqptr
FDB 0
GLOBAL litq
litq
RZB 1000
GLOBAL litptr
litptr
RZB 2
GLOBAL macq
macq
RZB 500
GLOBAL macptr
macptr
RZB 2
GLOBAL stdecl
stdecl
RZB 2
GLOBAL stage
stage
RZB 800
GLOBAL stagenex
stagenex
FDB 0
GLOBAL stagelas
stagelas
FDB 0
GLOBAL line
line
RZB 80
GLOBAL mline
mline
RZB 80
GLOBAL lptr
lptr
RZB 2
GLOBAL mptr
mptr
RZB 2
GLOBAL nxtlab
nxtlab
RZB 2
GLOBAL statlab
statlab
RZB 2
GLOBAL stlab
stlab
RZB 2
GLOBAL litlab
litlab
RZB 2
GLOBAL constval
constval
RZB 4
GLOBAL monitor
monitor
RZB 2
GLOBAL pause
pause
RZB 2
GLOBAL DEFDEBUG
DEFDEBUG
RZB 2
GLOBAL first_fu
first_fu
RZB 2
GLOBAL declared
declared
RZB 2
GLOBAL stkp
stkp
RZB 2
GLOBAL argstk
argstk
RZB 2
GLOBAL ncmp
ncmp
RZB 2
GLOBAL swactive
swactive
RZB 2
GLOBAL swdefaul
swdefaul
RZB 2
GLOBAL swnext
swnext
FDB 0
GLOBAL swend
swend
FDB 0
GLOBAL errcnt
errcnt
RZB 2
GLOBAL eof
eof
RZB 2
GLOBAL input
input
RZB 2
GLOBAL output
output
RZB 2
GLOBAL input2
input2
RZB 2
GLOBAL iflevel
iflevel
RZB 2
GLOBAL skipleve
skipleve
RZB 2
GLOBAL ctext
ctext
RZB 2
GLOBAL cmode
cmode
RZB 2
GLOBAL lastst
lastst
RZB 2
GLOBAL quote
quote
RZB 2
GLOBAL cptr
cptr
FDB 0
GLOBAL cptr2
cptr2
FDB 0
GLOBAL iptr
iptr
FDB 0
EXT addglb
EXT addloc
EXT addmac
EXT addstati
EXT amatch
EXT blanks
EXT cnl
EXT ch
EXT constexp
EXT defstora
EXT doasm
EXT dumpzero
EXT entry
EXT endst
EXT errrpt
EXT declexte
EXT findglb
EXT findloc
EXT getint
EXT getlabel
EXT header
EXT illname
EXT kill
EXT match
EXT multidef
EXT needbrac
EXT needsub
EXT newfunc
EXT nl
EXT number
EXT ns
EXT outbyte
EXT outdec
EXT outstr
EXT pl
EXT point
EXT printlab
EXT qstr
EXT sout
EXT stowlit
EXT symname
EXT trailer
EXT upper
NAME main
GLOBAL main
main
LDD 4,S
STD argcs
LDD 2,S
STD argvs
LDD #swq
STD swnext
PSHS D
LDD #100
PSHS D
ADDD ,S++
ADDD ,S++
PSHS D
LDD #4
PSHS D
ADDD ,S++
ADDD ,S++
STD swend
LDD #1
STD first_fu
LDD #1
COMA
COMB
ADDD #1
STD declared
LDD #symtab
STD glbptr
LDD #symtab
PSHS D
LDD #14
PSHS D
LDD #5
PULS X
JSR ccmult
ADDD ,S++
STD glbptr
LDD #stattab
STD statptr
LDD #symtab
PSHS D
LDD #512
PSHS D
LDD #14
PULS X
JSR ccmult
ADDD ,S++
ADDD #14
STD locptr
STD endsearc
STD startcom
LDD #stage
ADDD #800
PSHS D
LDD #1
PULS X
PSHS D
TFR X,D
SUBD ,S++
STD stagelas
LDD #wq
STD wqptr
LDD #quote
ADDD #1
PSHS D
LDD #0
STB [,S++]
STD stagenex
STD skipleve
STD iflevel
STD lastst
STD ncmp
STD output
STD input2
STD input
STD eof
STD errcnt
STD stkp
STD litptr
LDD #quote
ADDD #0
PSHS D
LDD #34
STB [,S++]
LDD #1
STD macptr
STD cmode
JSR ask
JSR header
JSR parse
JSR trailer
JSR closeout
JSR errrptsu
RTS
GLOBAL parse
parse
LEAS -2,S
cc2
LDD eof
PSHS D
LDD #0
CMPD ,S++
LBNE cc3
LDD #4
STD 0,S
LDD #cc1+0
PSHS D
LDD #6
PSHS D
JSR amatch
LEAS 4,S
CMPD #0
LBEQ cc4
LDD #3
STD 0,S
cc4
LDD #cc1+7
PSHS D
LDD #6
PSHS D
JSR amatch
LEAS 4,S
CMPD #0
LBEQ cc5
LDD #1
STD 0,S
cc5
LDD #_char
PSHS D
LDD #4
PSHS D
JSR amatch
LEAS 4,S
CMPD #0
LBEQ cc6
LDD #1
PSHS D
LDD #2
DECB
BLT *+8
ASL 1,S
ROL ,S
BRA *-7
PULS D
PSHS D
LDD 2,S
PSHS D
JSR declglb
LEAS 4,S
JSR ns
JMP cc7
cc6
LDD #_int
PSHS D
LDD #3
PSHS D
JSR amatch
LEAS 4,S
CMPD #0
LBEQ cc8
LDD #2
PSHS D
LDD #2
DECB
BLT *+8
ASL 1,S
ROL ,S
BRA *-7
PULS D
PSHS D
LDD 2,S
PSHS D
JSR declglb
LEAS 4,S
JSR ns
JMP cc9
cc8
LDD #cc1+14
PSHS D
JSR match
LEAS 2,S
CMPD #0
LBEQ cc10
JSR doasm
JMP cc11
cc10
LDD #cc1+19
PSHS D
JSR match
LEAS 2,S
CMPD #0
LBEQ cc12
JSR doinclud
JMP cc13
cc12
LDD #cc1+28
PSHS D
JSR match
LEAS 2,S
CMPD #0
LBEQ cc14
JSR addmac
JMP cc15
cc14
LDD 0,S
PSHS D
JSR newfunc
LEAS 2,S
cc15
cc13
cc11
cc9
cc7
JSR blanks
JMP cc2
cc3
LEAS 2,S
RTS
cc1 FCB 101,120,116,101,114,110,0,115,116,97
FCB 116,105,99,0,35,97,115,109,0,35
FCB 105,110,99,108,117,100,101,0,35,100
FCB 101,102,105,110,101,0
GLOBAL dumplits
dumplits
LEAS -4,S
LDD #0
STD 0,S
cc17
LDD 0,S
PSHS D
LDD litptr
CMPD ,S++
LBLE cc18
LDD 6,S
PSHS D
JSR defstora
LEAS 2,S
LDD #10
STD 2,S
cc19
LDD 2,S
SUBD #1
STD 2,S
ADDD #1
CMPD #0
LBEQ cc20
LDD #litq
PSHS D
LDD 2,S
ADDD ,S++
PSHS D
LDD 8,S
PSHS D
JSR getint
LEAS 4,S
PSHS D
JSR outdec
LEAS 2,S
LEAY 0,S
TFR Y,D
PSHS D
LDD 2,S
PSHS D
LDD 10,S
ADDD ,S++
STD [,S++]
LDD 2,S
PSHS D
LDD #0
CMPD ,S++
BEQ *+7
LDD #0
BRA *+5
LDD #1
PSHS D
LDD 2,S
PSHS D
LDD litptr
CMPD ,S++
BLE *+7
LDD #0
BRA *+5
LDD #1
ORA ,S+
ORB ,S+
CMPD #0
LBEQ cc21
JSR nl
JMP cc20
cc21
LDD #44
PSHS D
JSR outbyte
LEAS 2,S
JMP cc19
cc20
JMP cc17
cc18
LDD #0
STD litptr
LEAS 4,S
RTS
GLOBAL errrptsu
errrptsu
LDD ncmp
CMPD #0
LBEQ cc22
LDD #cc16+0
PSHS D
JSR errrpt
LEAS 2,S
cc22
LDD #1
STD output
JSR cnl
LDD errcnt
PSHS D
JSR outdec
LEAS 2,S
LDD #cc16+24
PSHS D
JSR outstr
LEAS 2,S
RTS
cc16 FCB 109,105,115,115,105,110,103,32,99,108
FCB 111,115,105,110,103,32,98,114,97,99
FCB 107,101,116,0,32,101,114,114,111,114
FCB 40,115,41,32,105,110,32,99,111,109
FCB 112,105,108,97,116,105,111,110,46,0
GLOBAL ask
ask
LEAS -4,S
LEAY 2,S
TFR Y,D
PSHS D
LDD #0
STD nxtlab
STD [,S++]
JSR getlabel
STD litlab
JSR kill
LDD #1
STD output
LDD #0
STD ctext
STD DEFDEBUG
STD pause
STD monitor
LDD argcs
PSHS D
LDD #1
CMPD ,S++
LBNE cc24
LDD #cc23+0
PSHS D
LDD #2
PSHS D
JSR sout
LEAS 4,S
LDD #cc23+35
PSHS D
LDD #2
PSHS D
JSR sout
LEAS 4,S
LDD #cc23+51
PSHS D
LDD #2
PSHS D
JSR sout
LEAS 4,S
LDD #0
PSHS D
JSR exit
LEAS 2,S
cc24
cc25
LDD argcs
SUBD #1
STD argcs
CMPD #0
LBEQ cc26
LEAY 0,S
TFR Y,D
PSHS D
LDD argvs
PSHS D
LDD 6,S
ADDD #1
STD 6,S
PSHS D
ADDD ,S++
ADDD ,S++
PSHS D
LDD [,S++]
STD [,S++]
LDD 0,S
PSHS D
LDB [,S++]
SEX
PSHS D
LDD #60
CMPD ,S++
LBNE cc27
LDD 0,S
ADDD #1
STD 0,S
PSHS D
LDD #cc23+53
PSHS D
JSR fopen
LEAS 4,S
STD input
PSHS D
LDD #0
CMPD ,S++
LBNE cc28
LDD #cc23+55
PSHS D
JSR errrpt
LEAS 2,S
LDD #0
PSHS D
JSR exit
LEAS 2,S
JMP cc29
cc28
JMP cc25
cc29
JMP cc30
cc27
LDD 0,S
PSHS D
LDB [,S++]
SEX
PSHS D
LDD #62
CMPD ,S++
LBNE cc31
LDD 0,S
ADDD #1
STD 0,S
PSHS D
LDD #cc23+72
PSHS D
JSR fopen
LEAS 4,S
STD output
PSHS D
LDD #0
CMPD ,S++
LBNE cc32
LDD #cc23+74
PSHS D
JSR errrpt
LEAS 2,S
LDD #0
PSHS D
JSR exit
LEAS 2,S
JMP cc33
cc32
JMP cc25
cc33
JMP cc34
cc31
LDD 0,S
ADDD #1
STD 0,S
SUBD #1
PSHS D
LDB [,S++]
SEX
PSHS D
LDD #45
CMPD ,S++
LBNE cc35
LDD 0,S
PSHS D
LDB [,S++]
SEX
PSHS D
JSR upper